local yichuipiao_skill = fk.CreateSkill {

  name = "#yichuipiao_skill",
  attached_equip = "yichuipiao",
  tags = { Skill.Compulsory, },

}

yichuipiao_skill:addAcquireEffect(function(self, player, is_start)
  player.room:setPlayerMark(player, "@@hezui", 1)
  player.room:setPlayerMark(player, "@!hezui", 1)
end)

yichuipiao_skill:addEffect(fk.EventPhaseEnd, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    local room = player.room
    if player:hasSkill(yichuipiao_skill.name) and player == target and player.phase == Player.Play then
      local events = room.logic:getEventsOfScope(GameEvent.ChangeHp, 1, function(e)
        if e.data.who == player and e.data.reason == "damage" then
          local first_damage_event = e:findParent(GameEvent.Damage)
          if first_damage_event then
            return false
          end
        end
        return true
      end, Player.HistoryPhase)
      if #events == 0 then
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, "@@hezui", 1)
    room:setPlayerMark(player, "@!hezui", 1)
  end,
})


yichuipiao_skill:addAcquireEffect(function(self, player, is_start)
  player.room:setPlayerMark(player, "@@hezui", 1)
  player.room:setPlayerMark(player, "@!hezui", 1)
end)






return yichuipiao_skill
